﻿@model IPagedList<ClassifyColumnLsitViewModel>

@using X.PagedList
@using X.PagedList.Mvc.Core

@{
    ViewBag.Title = "分类专栏";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>

    <div class="row">
    <div class="col-md-10 col-md-offset-1">
        <div class="panel panel-headline">
            <div class="panel-heading">
                <h3 class="panel-title">分类专栏展示</h3>
            </div>
            <div class="panel-body">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-md-8">
                            <div class="container-fluid">
                                <div class="row">
                                    <div class="col-sm-8">
                                        <form>
                                            <div class="input-group">
                                                <input type="search" class="form-control" name="search" value="@ViewBag.Search" />
                                                <span class="input-group-btn">
                                                    <button class="btn btn-primary">搜索</button>
                                                </span>
                                            </div>
                                        </form>
                                    </div>
                                    <div class="col-sm-4">
                                        <a href="~/ForumManage/ClassifyColumn/Add" class="btn btn-success">
                                            <i class="fa fa-plus-circle"></i> 新增权限
                                        </a>

                                        <a asp-action="Add" asp-control="Roles" class="btn btn-danger">
                                            <i class="fa fa-trash"></i>删除选中
                                        </a>
                                    </div>

                                </div>
                            </div>


                        </div>
                    </div>

                    <div class="row">
                        <div class="col-md-12">
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th>
                                            <input type="checkbox" name="checkAll" id="checkAll" />
                                            全选
                                        </th>
                                        <th>序号</th>
                                        <th>专栏名称</th>
                                        <th>专栏用户</th>
                                        <th>修改时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @for(var i = 0 ; i < Model.Count; i++)
                                    {
                                        <tr>
                                            <td>
                                                <input type="checkbox" name="checkMe" id="checkMe" />
                                                @Html.Hidden("Id",Model[i].Id)
                                            </td>

                                            <td>
                                                @(i+1)
                                            </td>

                                            <td>
                                                @Model[i].Title
                                            </td>

                                            <td>
                                                @Model[i].UsersTitle
                                            </td>

                                             <td>
                                                @Model[i].UpdateTime
                                            </td>

                                             <td>
                                                 <form action="../../ForumManage/ClassifyColumn/Delete" id="form_@Model[i].Id" method="post">
                                                     <a href="../../ForumManage/ClassifyColumn/Update/@Model[i].Id" class="btn btn-warning">
                                                        <i class="fa fa-pencil"></i> 修改
                                                     </a>
                                                      @Html.Hidden("Id",Model[i].Id)
                                                      <button type="button" onclick="deleteData('form_@Model[i].Id')" class="btn btn-danger">
                                                          <i class="fa fa-trash"></i> 删除
                                                      </button>
                                                 </form>
                                            </td>
                                        </tr>

                                    }
                                </tbody>
                            </table>

                            <nav aria-label="Page navigation">
                                <div class="pagination">
                                  <!-- 分页的地方我们现在用的内容是一段Html Helper分页标签  -->
                                  @Html.PagedListPager(Model,page => Url.Action("Index","ClassifyColumn",new{page,search=ViewBag.Search},"https","localhost:7087/ForumManage"))
                                </div>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section Scripts
{
    <script>
     function deleteData(formId)
     {
        if(confirm("确认删除么?"))
        {
            //确认了删除
            var form = "#"+formId;

            $(form).submit();
        }
     }
    
    </script>
}

</body>
</html>
